﻿using Newtonsoft.Json;
using Sustainalytics.LongRunningTaskManager.Interface;
using System.Collections.Generic;

namespace Sustainalytics.LongRunningTaskManager.Tests
{
    public class MyTaskParam
    {
        public int DelayMs { get; set; }

        public string Data { get; set; }

        public List<LongRunningTaskError> Errors { get; set; }

        public float? Progress { get; set; }


        public string ToJson()
        {
            string json = JsonConvert.SerializeObject(this);
            return json;
        }

        public static MyTaskParam FromJson(string json)
        {
            if (string.IsNullOrEmpty(json))
                return null;

            MyTaskParam param = JsonConvert.DeserializeObject<MyTaskParam>(json);
            return param;
        }
    }
}
